<!DOCTYPE html>

<head>
    <meta charset="UTF-8">
    <title>crawler</title>
    <script src="${request.contextPath}/statics/libs/jquery.min.js"></script>

</head>
<body>
<p>欢迎使用crawler爬虫工具</p>
查询的网站：<input type="text" id="inpt"  placeholder="有种你就填">
<input type="button" onclick="saveOrUpdate()" value="确定"/>
<script>
    $(function () {

    })
    var cont =337;
    var isok =true;
    var interval;
    var shuju =[9,12,16,24,49,50,69,72,73,74,75,166,167,168,169,170,171,172,225,226,227,228,229,232,234,273,274,347,348,349,351,352,357,359,360,362,363,364,365,366,367,368,369,370,371,372,373,509,703,704,705,710,711,712,
        713,714,715,722,723,724,725,731,733,737,738,740,741,742,744,747,749,751,753,754,755,757,759,760,761,762,763,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,
        789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,832,835,836,839,840,841,842,843,844,845,846,
        847,848,849,850,851,852,853,854,855,856,857,859,860,861,862,863,864,865,866,867,868,869,870,871,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,895,896,897,898,899,900,902,
        903,905,906,907,908,909,910,911,912,914,915,916,917,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,938,939,940,942,943,944,945,946,947,948,949,950,951,952,953,954,
        955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999,
        1000,1001,1002,1003,1004,1005,1006,1007,1009,1010,1011,1012,1013,1015,1016,1017,1018,1019,1020,1021,1022,1024,1025,1027,1029,1030,1031,1032,1034,1035,1037,1038,1040,1041,1044,1046,1047,1048,1050,1052,
        1053,1054,1056,1057,1058,1061,1064,1065,1066,1068,1070,1071,1072,1075,1076,1078,1079,1080,1081,1082,1084,1086,1087,1089,1090,1092,1094,1095,1096,1098,1099,1100,1103,1104,1105,1107,1108,1109,1111,
        1112,1113,1115,1116,1117,1119,1120,1122,1124,1125,1126,1128,1130,1131,1132,1134,1138,1139,1140,1141,1143,1144,1145,1146,1147,1148,1149,1150,1151,1152,1153,1154,1155,
        1156,1157,1158,1159,1160,1161,1162,1163,1164,1165,1166,1167,1168,1169,1170,1171,1172,1173,1174,1176,1180,1181,1184,1186,1188,1190,1191,1194,1195,1197,1198,1201,1203,1205,1207,1209,1210,1213,1215,1216,1217,1218,1220,1221,
        1223,1224,1226,1227,1230,1232,1236,1238,1240,1241,1242,1243,1244,1245,1248,1250,1251,1252];
    function saveOrUpdate() {
        interval =setInterval('saveOrUpdatexun()', 1000); ;
    }
    function saveOrUpdatexun(){
        if(isok){
            if(cont<shuju.length){
                $.ajax({
                    type: "POST",
                    url:"/api/crawler/renwu",
                    async: false,
                    cache: true,

                    data:{crawlurl:"http://baike.1kuang.com/baike-"+shuju[cont]+".html"},
                    success: function(r){
                        if(r.code == 0){
                            cont++;
                            isok =true;
                            console.log("asaaaaaaaaa+cont::"+cont+"       zhaugtissn:::::::"+shuju[cont]);
                        }else{
                            alert(r.msg);
                        }
                    },
                    beforeSend:function () {
                        isok=false;
                        console.log("开始发送：：：cont："+cont+"       zhaugtissn:::::::"+shuju[cont]);
                    }
                });
            }else{
                console.log("结束！！！！")
                clearInterval(interval);
            }
        }
    }

</script>
</body>
</html>